<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改书籍借阅')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-borrow-edit" th:object="${bookBorrow}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">书籍编号：</label>
            <div class="col-sm-8">
                <input name="sn" th:field="*{sn}" class="form-control" type="text" required  th:readonly="${!isEditable}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">书籍名称：</label>
            <div class="col-sm-8">
                <input name="title" th:field="*{title}" class="form-control" type="text" th:readonly="${!isEditable}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">申请人：</label>
            <div class="col-sm-8">
                <input name="applyUser" th:field="*{applyUser}" class="form-control" type="text" th:readonly="${!isEditable}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">申请时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="beginDate" th:value="${#dates.format(bookBorrow.beginDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" th:readonly="${!isEditable}">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">结束时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="endDate" th:value="${#dates.format(bookBorrow.endDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" th:readonly="${!isEditable}">
                </div>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    var prefix = ctx + "bisiness/borrow";
    $("#form-borrow-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-borrow-edit').serialize());
        }
    }

    $("input[name='beginDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='endDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>